Skip to content

dgb: M3 external-daemon RPC transport (coin-layer source + guards) - #149

Merged
frstrtr merged 6 commits into
masterfrom
dgb/m3-rpc-transport
Jun 18, 2026
Merged

dgb: M3 external-daemon RPC transport (coin-layer source + guards)#149
frstrtr merged 6 commits into
masterfrom
dgb/m3-rpc-transport

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 18, 2026

Copy link
Copy Markdown
Owner

M3 DGB external-daemon RPC transport — coin-layer SOURCE only (Option-B scope: transport rpc.cpp wiring deferred post-merge). Per-coin isolation clean; src/impl/dgb/ only.

Contents (6 commits onto master @d5879c9b)

  • 2bc081e3 external-daemon RPC transport coin-layer (rpc.hpp stub->real + ~440L rpc.cpp btc-mirror + softfork_check.hpp)
  • 24515a73 conform daemon-version floor to oracle 71700->82202 (DGB Core 7.17.2 VERSION_CHECK)
  • 00c39ebe RPC request-shape SSOT (floor 82202 + make_gbt_request {rules:[segwit], algo:scrypt}) + guard
  • fc2ec32b softfork-detection standalone guard (3 encodings + robustness)
  • 29a0ce86 chain-identity genesis SSOT (DGB_GENESIS_MAIN/TEST + selector, bucket-1 isolation primitive) + guard
  • 0095da79 wire all 3 guards into ctest + BOTH build.yml --target allowlists (avoids ci: build test_dgb_subsidy in both Linux test jobs (fix master-red NOT_BUILT) #143 NOT_BUILT trap)

Scope notes

  • GBT request fixed to {rules:[segwit], algo:scrypt} — scrypt is an algo, not a softfork rule.
  • Version floor + genesis identity conformed against own oracle frstrtr/p2pool-dgb-scrypt (NOT v35).
  • Transport rpc.cpp is SOURCE-present but NOT CMake-wired into the daemon path yet (Option-B, deferred).
  • External-daemon (digibyted RPC) kept as a FALLBACK alongside embedded — never removed.

Verification

  • 3 guard targets build EXIT=0; 23/23 assertions pass (rpc-request 8, softfork 8, genesis 7).
  • All 3 discovered by ctest (gtest_add_tests AUTO) and present in both build.yml allowlists.

HOLD MERGE — integrator surfaces the merge card on operator approval.

frstrtr added 6 commits June 18, 2026 06:39
Port the real boost::beast + jsonrpccxx HTTP JSON-RPC client to an
external digibyted, mirroring src/impl/btc/coin/rpc.{hpp,cpp}. This is
the external-daemon FALLBACK path V36 mandates persist alongside the
embedded daemon.

- rpc.hpp: NodeRPC promoted from Path-A stub to real client surface
  (connect/reconnect/getwork/submit_block[_hex]/check + RPC methods).
- rpc.cpp: ~440L transport mirror of btc, with DGB conformance:
  * getblocktemplate sends {"rules":["segwit"],"algo":"scrypt"} --
    Scrypt is the mining algo (separate GBT param), NOT a BIP9 rule;
    fixes the incorrect Path-A stub note rules=["scrypt"].
  * check(): chain-identity probe via DigiByte genesis hash
    (mainnet/testnet by IS_TESTNET) + daemon version floor
    [confirm-vs-oracle on exact floor] + required-softfork gate.
- softfork_check.hpp: 1:1 helper normalising the three getblockchaininfo
  softfork encodings (array-of-objects / array-of-strings / bip9 object).

CMake/OBJECT-lib registration + construction-site ctor swap deferred to
the post-#145 base (the surface #145 restructures); this commit is
additive coin-layer source, build-verified standalone (TU compile
EXIT=0).
DGB_MIN_DAEMON_VERSION resolved against frstrtr/p2pool-dgb-scrypt
networks/digibyte.py VERSION_CHECK (oracle HEAD 22761e7): floor is
82202 (DigiByte Core 7.17.2), not the placeholder 71700. Gates the
same getnetworkinfo[version] field the oracle does, so the check is
oracle-equivalent. Closes the last [confirm-vs-oracle] on the M3
RPC transport slice.
Factor the two oracle-pinned external-RPC contract values out of rpc.cpp
into a pure, dependency-light header (coin/rpc_request.hpp) so they have a
single source of truth and can be guarded by a standalone test that does
NOT link the boost::beast/jsonrpccxx transport (never enters the dgb
OBJECT lib):

  - DGB_MIN_DAEMON_VERSION / daemon_version_acceptable(): getnetworkinfo
    [version] accept floor, conformed to oracle frstrtr/p2pool-dgb-scrypt
    VERSION_CHECK == 82202 (DigiByte Core 7.17.2).
  - make_gbt_request(): getblocktemplate body {rules:[...],algo:scrypt} --
    segwit rule mandatory, scrypt is a SEPARATE algo param, never a rule.

rpc.cpp now consumes the header (behaviour-identical: version compare and
GBT body unchanged on the wire). Adds test/rpc_request_test.cpp (8 gtest
cases) pinning the floor accept/reject boundary (82202 ok / 82201,71700
reject) and the GBT shape incl. the Path-A scrypt-as-rule regression.

Standalone build-verified: g++ -std=c++20, link libgtest -> 8/8 PASS;
rpc.cpp -fsyntax-only EXIT=0. No CMake/OBJECT-lib wiring (deferred post
land-stack); additive coin-layer source only.
Pin collect_softfork_names() (softfork_check.hpp) across all three
getblockchaininfo softfork encodings (array-of-objects / array-of-strings /
object-keyed) plus accumulation + scalar no-op robustness. Guards the
softfork-gate parser NodeRPC uses to confirm segwit before trusting the
Scrypt GBT path, BEFORE the deferred post-#145 wiring CI-links rpc.cpp.

Header-only + nlohmann + gtest, no transport link -- standalone, does not
enter the dgb OBJECT lib.
Factor the DigiByte genesis hashes NodeRPC::check() probes out of rpc.cpp
into the rpc_request.hpp SSOT (DGB_GENESIS_MAIN/TEST + dgb_genesis_hash()
selector), mirroring how the daemon-version floor was made SSOT+guarded.
rpc.cpp now consumes them; the genesis hashes are a bucket-1 isolation
primitive (coin-identity, KEEP per-coin v36/v37, never standardized) --
pinned here only so a standalone TU can guard them.

Add test/genesis_check_test.cpp (7 cases): canonical mainnet/testnet
hashes, main != test (no copy/paste), 64-hex shape, and the IS_TESTNET
selector NodeRPC::check() relies on. Links only the pure SSOT header +
gtest -- no boost::beast transport, builds standalone (7/7 PASS).

CMake/OBJECT-lib registration of this test deferred to the post-#145 base
with the rest of the transport wiring.
Register the three standalone M3 regression guards
(rpc_request_test / softfork_check_test / genesis_check_test) as ctest
targets in src/impl/dgb/test/CMakeLists.txt and add them to BOTH
build.yml --target allowlists. Header-only: each links only GTest +
nlohmann_json (no OBJECT lib), so they stay buildable while the
external-daemon transport rpc.cpp wiring remains deferred (Option-B).

Avoids the #143 NOT_BUILT trap: a gtest target present in CMake but
absent from the build.yml allowlist becomes a NOT_BUILT sentinel that
reds master. Both lists, always.

23/23 guard assertions pass (rpc-request 8, softfork 8, genesis 7).
@frstrtr
frstrtr merged commit 6fcfcb7 into master Jun 18, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant